package org.example.functionInterface;

import java.util.Random;
import java.util.function.Supplier;

public class Demo02Supplier {
    //Supplier`接口中包含一个抽象方法` T get(): 用来获取一个泛型参数指定类型的对象数据。
    public static void main(String[] args) {
        int num = getNum(() -> {
            return new Random().nextInt();
        });
        System.out.println(num);
    }

    public static int getNum(Supplier<Integer> supplier) {
        int num = supplier.get();
        return num;
    }
}
 